<template >
  <div class="index">
      <div class="sidebar">
          <div class="lefttop">发货通知单</div>
          <div class="sidebar-item" :class="{ 'pitch': route.meta.belong.includes('selfOwned') }" @click="goto(1)">
              自有发货通知单
          </div>
          <div class="sidebar-item" :class="{ 'pitch': route.meta.belong.includes('external') }" @click="goto(2)">
              外来发货通知单</div>
      </div>
      <div class="PageMain">
          <router-view></router-view>
      </div>
  </div>
</template>

<script setup>
import { onMounted } from 'vue'
import { useRouter, useRoute } from 'vue-router'
const router = useRouter()
const route = useRoute()

const goto = (val) => {
  val === 1
      ? router.push({
          path: '/ExportLogistics/ShippingNotice/selfOwnedShippingNotice'
      })
      : router.push({
          path: '/ExportLogistics/ShippingNotice/externalShipmentNotice'
      })
}

onMounted(()=>{
    if(route.path == '/ExportLogistics/ShippingNotice/externalShipmentNotice'){
        goto(2);
    }
    if(route.path == '/ExportLogistics/ShippingNotice/selfOwnedShippingNotice'){
        goto(1);
    }
    if(route.path == '/ExportLogistics/ShippingNotice'){
        goto(1);
    }
})


</script>

<style lang="scss" scoped>
.index {
  display: flex;
  justify-content: flex-start;
  // align-items: center;
}

.PageMain{
  width: calc(100%);
  padding-left: 130px;
}



.sidebar {
  position: fixed;
  width: 130px;
  height: 100vh;
  background: #ffffff;
  padding: 4px;
  border: 1px solid #E5E6E9;
  font-weight: 500;
  margin-left: -1px;
  margin-top: -1px;

  .lefttop {
      width: 100%;
      height: 40px;
      border-bottom: 1px solid #efeff0;
      box-sizing: border-box;
      padding-left: 10px;
      font-size: 14px;
      // color: #3c4144;
      letter-spacing: -1px;
      font-weight: 500;
      line-height: 39px;
      margin-bottom: 4px;
  }

  .sidebar-item {
      width: 100%;
      height: 38px;
      // background-color: #F2F3F5;
      text-align: center;
      line-height: 38px;
      margin-bottom: 4px;
      cursor: pointer;
      color: #bbbcbe;
      // opacity: 0.65;
  }

  .pitch {
      background-color: #E6F7FF;
      color: #409eff;
      font-weight: 500;
  }
}
</style>